﻿@{
    Layout = null;
    ViewBag.Title = "归档材料根类型选择弹出框";
}
<div class="pageContent" layouth="38">
    <form method="post" action="demo/common/ajaxDone.html" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone)">
        <ul id="project_fileType_zTree" class="ztree">
        </ul>
    </form>
</div>
<div class="formBar">
    <ul>
        <li>
            <button type="button" class="btn btn-success btn-sm" onclick="project_fileType_zTree_typeSel()">
                选择</button>
        </li>
        <li>
            <button type="button" class="close btn btn-default btn-sm">
                取消</button>
        </li>
    </ul>
</div>
<script type="text/javascript">
    var project_fileType_zTree;
    var project_fileType_zTree_setting = {
        treeObjId: "project_fileType_zTree",
        isSimpleData: true,              //数据是否采用简单 Array 格式，默认false
        treeNodeKey: "id",               //在isSimpleData格式下，当前节点id属性
        treeNodeParentKey: "pId",        //在isSimpleData格式下，当前节点的父节点id属性
        showLine: true,                  //是否显示节点间的连线
        checkable: true,                 //每个节点上是否显示 CheckBox
        checkStyle: "radio"   //多选 checkbox   单选 radio
    };
    $(function () {
        var utype = $("#TheBcdProjectInfo_P_UType").val();
        $.getJSON(
           "/CompletionMaterials/FileList/FileTypeJson?utype=" + encodeURI(utype),
           function (data) {
               project_fileType_zTree = $("#project_fileType_zTree").zTree(project_fileType_zTree_setting, data);
           });
    });

    function project_fileType_zTree_typeSel() {
        var typeIds = "";
        var typeNames = "";
        var nodes = project_fileType_zTree.getCheckedNodes(true);
        for (var i = 0; i < nodes.length; i++) {
            typeIds += nodes[i].id + ",";
            typeNames += nodes[i].name.replace("(" + nodes[i].id + ")", "") + ",";
        }
        if (typeIds != "")
            typeIds = typeIds.substring(0, typeIds.length - 1);
        if (typeNames != "")
            typeNames = typeNames.substring(0, typeNames.length - 1);
        $("#TheBcdProjectInfo_Fd_ID").val(typeIds);
        $("#TheBcdProjectInfo_Fd_Name").val(typeNames);
        $.bringBack();

    }
</script>
